package l_chain_of_responsibility.b_design_pattern;

/**
 * Created by wug on 2016/8/9 0009.
 */
public class MainTest {
    public static void main(String[] args) {
        String str = "/smile<script>while(true){alert(\"ok\")}</script>第三十一届夏季奥林匹克运动会AV女优又称里约奥运会绿茶婊";
        Request request = new Request();
        request.setRequestStr(str);
        Response response = new Response();


        /**
         * 组装责任链 （好处是显而易见的 可以动态组装链路）
         */
        FilterChain chain = new FilterChain();
        chain.addFilter(new FaceHandler()).addFilter(new HtmlHandler()).addFilter(new SensitiveHandler());

        System.out.println("Request: " + request.getRequestStr());

        chain.doFilter(request, response, chain);
        System.out.println(response.getResponseStr());
    }
}
